package com.aeon.ui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;

public class TextComposite extends Composite {
	private Text mText;

	public TextComposite(Composite parent, int style) {
		super(parent, style);

		this.setLayout(new FillLayout());
		mText = new Text(parent, SWT.BORDER);

		mText.addModifyListener(new ModifyListener() {

			@Override
			public void modifyText(ModifyEvent e) {
				// TODO Auto-generated method stub
				System.out.println("modified");
			}
		});

		mText.addListener(SWT.Verify, new Listener() {//SWT.Modify | SWT.Verify :will not work. 24|25=25.do not put multiple event constants

			@Override
			public void handleEvent(Event event) {
				int i = SWT.Modify | SWT.Verify;//do not put multiple event constants

				switch (event.type) {
				case SWT.Modify:
					System.out.println("modified");
					break;
				case SWT.Verify:
					System.out.println("verified");
					break;
				default:
					System.out.println("unknown");
					break;
				}

			}
		});

	}

}
